package com.my.study.algorithm.str;

/**
 * sunday算法
 * 参考博客：https://www.programminghunter.com/article/20121318955/
 *
 * @author: yidujun
 * @create: 2022/03/07 20:32
 */
public class SundayStr {

    public static void main(String[] args) {

    }

    public static int contains(char[] str, char ch) {
        for (int i = str.length - 1; i >= 0; i--) {
            if (str[i] == ch) {
                return i;
            }
        }
        return -1;
    }

    /**
     * sunday算法
     *
     * @param target  目标字符串
     * @param pattern 匹配字符串
     */
    public static void sunday(String target, String pattern) {
        char[] charTarget = target.toCharArray();
        char[] charPattern = pattern.toCharArray();
        int targetLen = target.length();
        int patternLen = pattern.length();
        int t = 0;
        int p = 0;
        while (t <= targetLen - patternLen + p) {
            if (charTarget[t] != charPattern[p] && t == targetLen - patternLen + p) {
                break;
            }
        }


    }


}
